<?php
class Model_Prefecture
{
    public function getMap()
    {
        $map = array(
        '01' => '北海道',
		'02' => '青森県',
		'03' => '岩手県',
		'04' => '宮城県',
		'05' => '秋田県',
		'06' => '山形県',
		'07' => '福島県',
		'08' => '茨城県',
		'09' => '栃木県',
		'10' => '群馬県',
		'11' => '埼玉県',
		'12' => '千葉県',
		'13' => '東京都',
		'14' => '神奈川県',
		'15' => '新潟県',
		'16' => '富山県',
		'17' => '石川県',
		'18' => '福井県',
		'19' => '山梨県',
		'20' => '長野県',
		'21' => '岐阜県',
		'22' => '静岡県',
		'23' => '愛知県',
		'24' => '三重県',
		'25' => '滋賀県',
		'26' => '京都府',
		'27' => '大阪府',
		'28' => '兵庫県',
		'29' => '奈良県',
		'30' => '和歌山県',
		'31' => '鳥取県',
		'32' => '島根県',
		'33' => '岡山県',
		'34' => '広島県',
		'35' => '山口県',
		'36' => '徳島県',
		'37' => '香川県',
		'38' => '愛媛県',
		'39' => '高知県',
		'40' => '福岡県',
		'41' => '佐賀県',
		'42' => '長崎県',
		'43' => '熊本県',
		'44' => '大分県',
		'45' => '宮崎県',
		'46' => '鹿児島県',
		'47' => '沖縄県'
		);
        return $map;
    }
    public function getName($prefecture_code)
    {
        $map = $this->getMap();
        return $map[$prefecture_code];
    }
    public function getCode($name)
    {
        $map = $this->getMap();
        return array_search($name, $map);
    }
    public function getAreaMap()
    {
        $map = array(
                '01' => '北海道・東北',
                '02' => '関東',
                '03' => '中部',
                '04' => '近畿',
                '05' => '中国・四国',
                '06' => '九州・沖縄'
        );
        return $map;
    }
    public function getAreaName($area_code)
    {
        $map = $this->getAreaMap();
        return $map[$area_code];
    }
    public function getAreaPrefMap()
    {
        $map = array(
                '01' => array('01','02', '03', '04', '05', '06', '07'),
                '02' => array('08', '09', '10', '11', '12', '13', '14'),
                '03' => array('15', '16', '17', '18', '19', '20', '21', '22', '23', '24'),
                '04' => array('25', '26', '27', '28', '29', '30'),
                '05' => array('31', '32', '33', '34', '35', '36', '37', '38', '39'),
                '06' => array('40', '41', '42', '43', '44', '45', '46', '47')
        );
        return $map;
    }
}
?>